Image processing device superimposing supplemental image on original image

ABSTRACT

An image processing device performs: setting a focal pixel among a plurality of pixels in an original image that is represented by original image data; setting a pixel near the focal pixel as a near pixel; acquiring a degree of difference in luminance for the focal pixel and the near pixel; determining, based on the degree of difference, at least one of: a size of a supplemental image; a shape of the supplemental image; color of the supplemental image; and luminance of the supplemental image; and generating edited image data by editing the original image data, the edited image data representing an edited image obtained by superimposing the supplemental image on the original image, the supplemental image being superimposed on an area around the focal pixel in the original image.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. application Ser. No.13/073,643, filed Mar. 28, 2011, which claims priority from JapanesePatent Application No. 2010-170857 filed Jul. 29, 2010. The entirecontents of the above noted applications are incorporated herein byreference.

TECHNICAL FIELD

The present invention relates to an image processing device.

BACKGROUND

There are various techniques known in the art for producing rays oflight or other decorative elements in digital images, such asphotographs. For example, one technique extracts very bright pixelshaving a luminance greater than a prescribed value, such as pixels forpoint light sources or specular highlights, and produces star patternsin the original image centered on the extracted bright pixels, creatingan effect that emphasizes light from the point light sources and thelike.

SUMMARY

However, this technique can sometimes produce a large number of starpatterns in image areas having a concentration of high-luminance pixels,such as within an image of clouds on a bright day. In such cases, thedecorative elements rendered in the image are not sufficientlyexpressive.

In view of the foregoing, it is an object of the invention to provide animage processing device enhancing the expressiveness of images withdecorative elements.

In order to attain the above and other objects, the invention providesan image processing device including a processor and a memory storingcomputer-readable instructions therein. The computer-readableinstructions, when executed by the processor, causes the imageprocessing device to perform: setting a focal pixel among a plurality ofpixels in an original image that is represented by original image data;setting a pixel near the focal pixel as a near pixel; acquiring a degreeof difference in luminance for the focal pixel and the near pixel;determining, based on the degree of difference, at least one of: a sizeof a supplemental image; a shape of the supplemental image; color of thesupplemental image; and luminance of the supplemental image; andgenerating edited image data by editing the original image data, theedited image data representing an edited image obtained by superimposingthe supplemental image on the original image, the supplemental imagebeing superimposed on an area around the focal pixel in the originalimage.

According to another aspect, the present invention provides anon-transitory computer readable storage medium storing a set of programinstructions. The program instructions, when executed by a processor,causes an image processing device to perform: setting a focal pixelamong a plurality of pixels in an original image that is represented byoriginal image data; setting a pixel near the focal pixel as a nearpixel; acquiring a degree of difference in luminance for the focal pixeland the near pixel; determining, based on the degree of difference, atleast one of: a size of a supplemental image; a shape of thesupplemental image; color of the supplemental image; and luminance ofthe supplemental image; and generating edited image data by editing theoriginal image data, the edited image data representing an edited imageobtained by superimposing the supplemental image on the original image,the supplemental image being superimposed on an area around the focalpixel in the original image.

BRIEF DESCRIPTION OF THE DRAWINGS

The particular features and advantages of the invention as well as otherobjects will become apparent from the following description taken inconnection with the accompanying drawings, in which:

FIG. 1 is a block diagram showing an image processing device accordingto an embodiment of the invention;

FIG. 2 is a flowchart illustrating steps in an embellishing processexecuted by the image processing device;

FIG. 3 is a flowchart illustrating steps in a selecting process in FIG.2;

FIG. 4 is an explanatory diagram illustrating the relationship between afocal pixel and neighboring pixels;

FIG. 5 is a flowchart illustrating steps in a selecting process in FIG.2;

FIG. 6 is an explanatory diagram showing an example of a supplementalimage;

FIG. 7 is an explanatory diagram showing an example of an originalimage;

FIG. 8 is an explanatory diagram showing an edited image generated byediting the original image shown in FIG. 7;

FIG. 9 is an explanatory diagram showing an edited image depicting anlamp in a light background;

FIG. 10 is an explanatory diagram showing an edited image depicting alamp in a dark background; and

FIG. 11 is a block diagram showing an image processing device accordingto a modification of the invention.

DETAILED DESCRIPTION

Next, a computer 10 according to a first embodiment of the presentinvention will be described while referring to FIGS. 1 through 10. Thecomputer 10 includes a CPU 11, a ROM 12, a RAM 13, a hard disk drive(HDD) 14, an operating unit 15, a display unit 16, and a networkinterface 17.

The ROM 12 stores various programs such as BIOS. The HDD 14 storesvarious software programs including an operating system (OS),application programs capable of editing graphic image data. The CPU 11controls operations of the computer 10 in accordance with the programsread from the ROM 12 and the HDD 14 and stores the processing result inthe RAM 13 and the HDD 14.

The operating unit 15 includes a keyboard and a pointing device andallows the user to input various instructions to the CPU 11 throughexternal operations of the operating unit 15. The display unit 16includes a display and displays various images in accordance with thecontrol of the CPU 11. The network interface 17 is capable of connectingto communication lines (not shown) such a LAN and is capable ofcommunicating with a printer and a computer that are connected with thecommunication lines.

Next, an embellishing process for rendering star patterns in an originalimage as decorative elements will be described. The CPU 11 of thecomputer 10 begins the embellishing process shown in FIG. 2 when theuser of the computer 10 launches an application program for editingimages using the operating unit 15, specifies a file stored on the HDD14 or the like that holds original image data in which the user wishesto generate star patterns, and inputs an instruction to execute theembellishing process.

In S101 of the embellishing process shown in FIG. 2, the CPU 11 performsa selecting process to select target pixels in the original image dataas targets for rendering star patterns (supplemental images). In S102the CPU 11 performs an editing process to edit the original image dataso that star patterns are rendered for the target pixels.

Next, the two processes mentioned in the embellishing process will bedescribed in greater detail. In S201 at the beginning of the selectionprocess in FIG. 3, the CPU 11 selects and sets one pixel from aplurality of pixels in the original image represented by the originalimage data as the focal pixel. As will be described later, the CPU 11sequentially selects each pixel constituting the original image as afocal pixel during the selection process.

In S202 the CPU 11 sets neighboring pixels (near pixels) and finds asecond characteristic value for the selected focal pixel. In the firstembodiment, the second characteristic value is the variance of luminancefor the selected focal pixel and neighboring pixels of the focal pixel.Using the example shown in FIG. 4, the focal pixel is pixel P(i, j) inthe center position having coordinates (i, j), and the neighboringpixels are the 24 total pixels within the range (i−2 through i+2, j−2through j+2), excluding the focal pixel.

The variance is one value that indicates the variation, or “spread,” ofluminance in a sample and is equivalent to the mean of the samplesquared minus the square of the sample mean. Hence, if Py(i, j) denotesthe luminance of the focal pixel, then the variance Var(i, j) for thisfocal pixel can be found from the following equation based on theaverage luminance of the focal pixel and its neighboring pixels for thisfocal pixel can be found from the following Equation 1 based on theaverage luminance of the focal pixel and its neighboring pixels AvePy(i,j) and the average of the square of this luminance AvePy2(i, j).

Var(i, j)=AvePy2(i, j)−((AvePy(i, j))²   Equation 1

The original image data in the first embodiment has an 8-bit (256-level)gradation value for each of the RGB colors. It is well known that theluminance of a pixel is near the green gradation value for that pixel.Therefore, the following expression can be used to approximate thevariance Var(i, j) based on the average green gradation value for thefocal pixel and its neighboring pixels AvePg(i, j) and the mean of thesquare of this gradation value AvePg2(i, j).

Var(i, j)≈AvePg2(i, j)−((AvePg(i, j))²   Equation 2

Equations for finding the luminance (Py) of a pixel from gradationvalues of the RGB colors (Pr, Pg, Pb) are well known in the art (forexample, Py=0.30Pr+0.59Pg+0.11Pb). The variance Var(i, j) may be foundfrom Equation 1 using one of these conventional equations for findingluminance.

Next, the variance Var(i, j) is normalized to the range 0.0-1.0, and thenormalized variance is set as the second characteristic value f(i, j).Since the maximum value of variance Var(i, j) is 255 squared, the secondcharacteristic value f(i, j) is found from the following Equation 3.

f(i, j)=Var(i, j)/255²   Equation 3

Returning to the flowchart in FIG. 3, in S203 the CPU 11 determineswhether or not the second characteristic value f(i, j) is greater than apredetermined reference value (0.15 in the first embodiment). Thisreference value is a threshold for determining whether the focal pixelis a candidate for representing a star pattern pixel (hereinafterreferred to as a “candidate pixel”) and can be modified appropriatelywithin the range 0.0<Th<1.0, where Th is the reference value.

If the second characteristic value f(i, j) is greater than the referencevalue Th (0.15; S203: YES), in S204 the CPU 11 stores this focal pixelin the RAM 13 as a candidate pixel. However, if the secondcharacteristic value f(i, j) is less than or equal to the referencevalue Th (S203: NO), in S205 the CPU 11 stores this focal pixel in theRAM 13 as a non-candidate pixel.

In S206 the CPU 11 determines whether all pixels in the original imagedata have been selected as the focal pixel in S201. When there remainpixels that have not been selected as the focal pixel (S206: NO), theCPU 11 returns to S201 and repeats the above process for a differentpixel that was not previously selected as the focal pixel. Through thisprocess, the CPU 11 extracts focal pixels from the original image dataas candidate pixels when the variation between the focal pixel and itsneighboring pixels is large.

When the CPU 11 determines in S206 that all pixels have been selectedone time as the focal pixel (S206: YES), in S207 the CPU 11 selectscandidate pixels to be target pixels representing a star pattern image.

In S207, the target pixels may be pixels randomly extracted from thecandidate pixels at a prescribed probability (0.1%, for example). Thisprobability may be set to a suitable value greater than 0% and less than100%. A proper number of pixels can be set as target pixels bydecreasing the probability when the number of candidate pixels is highand increasing the probability when the number is low.

By adjusting the probability, the CPU 11 can select candidate pixels ofa number equal to or near a predetermined number to be target pixels.One way to find a suitable probability is to divide the predeterminednumber of target pixels by the total number of candidate pixels. The CPU11 executes the editing process of S102 after completing this selectionprocess in S207.

In S301 at the beginning of the editing process in FIG. 5, the CPU 11selects one pixel from among the target pixels selected in the selectingprocess. In S302 the CPU 11 calculates a first characteristic value ofthe target pixel selected in S301 for determining the form of the starpattern that will be rendered. In the first embodiment, the firstcharacteristic value is a value obtained by normalizing (according to adifferent method than that used for the second characteristic value) thevalue indicating the degree of variation (spread) in luminance valuesfor the target pixel and its neighboring pixels. The neighboring pixelsof the target pixel are pixels that fall within the same range as theneighboring pixels for the focal pixel described earlier (see FIG. 4).

In order to find the first characteristic value, first the CPU 11 findsthe second characteristic value f(i, j), which is the variance ofluminance for the target pixel at coordinates (i, j) and its neighboringpixels, using the method described earlier. The second characteristicvalue f(i, j) is a value that falls within the range Th<f(i, j)≦1.0. Inorder to concentrate the distribution of second characteristic valuesfor a plurality of target pixels near the reference value Th, the rangeof distribution is adjusted using the following Equation 4.

Var“(i, j)=8×(Var(i, j)−0.15   Equation 4

In the above Equation 4, “0.15” is the reference value Th and “8” is acoefficient found experimentally. The value of Var“(i, j) found in thisequation is normalized to the range 0.0-1.0 in the following Equation 5to obtain a first characteristic value f′(i, j).

f′(i, j)=1.0, when Var”(i, j)≧1.0; and

f′(i, j)=Var″(i, j), when Var″(i, j) 1.0   Equation 5

In S303 the CPU 11 determines the size of the star pattern to berendered for the target pixel based on the first characteristic valuef′(i, j) found above. FIG. 6 shows an example of rendering a four-pointstar pattern 20. The shape of the star pattern can be modified asdesired.

The star pattern 20 has four rays (radiating lines) of equal lengthextending respectively up, down, left, and right from a center point C.The length LEN of each radiating line can be calculated from thefollowing Equation 6 based on the first characteristic value f′(i, j),where the length LEN is expressed in pixels.

LEN=((Smax−Smin)f′(i, j)+Smin)×XYmax/L   Equation 6

In the above Equation 6, XYmax is the length of the longer side betweenthe vertical and horizontal sides of the original image data (in numberof pixels), and L is a predetermined constant. Hence, the length LEN ofthe radiating line is proportional to the length in pixels of the longside of the original image data.

Further, Smax and Smin in the above equation 6 are constants definingthe maximum and minimum possible values of the length LEN for eachradiating line, where Smax>Smin When the first characteristic valuef′(i, j) is “1”, the value within the outer parentheses of Equation 6 isSmax. When the first characteristic value f′(i, j) approaches “0”, thevalue within the outer parentheses approaches Smin. In other words, thelength LEN of the radiating lines increases as first characteristicvalue f′(i, j) increases.

Returning to the flowchart in FIG. 5, in S304 the CPU 11 calculatesedited pixel values for each pixel within the target region of theoriginal image data for rendering the star pattern 20. The target regionin this example is a (2×LEN+1)×(2×LEN+1) square-shaped area centered onthe target pixel. In this process, the CPU 11 renders a star pattern inthe edited image by increasing the luminance of pixels rendering thestar pattern 20 in the target region.

More specifically, the application program has basic data specifyingrelationships between coordinates for rendering the star pattern and thedegree for accentuating luminance. Based on this data, the CPU 11calculates a function y(m, n) for rendering the star pattern 20 shown inFIG. 6. The variables m and n are values within the range −LEN m,n≦LENand specify coordinates (m, n) in reference to the center point C.

The function y(m, n) indicates the accentuation of luminance (degree ofincrease) and is a value within the range 0.0≦(m, n)≦1.0. For pixelsnear the center point C of the star pattern 20, γ(m, n)=1.0, indicatingthe largest accentuation of luminance. When moving from the center pointC of the star pattern 20 toward the peripheral edges thereof, γ(m, n)gradually decreases from 1.0. In areas outside of the star pattern 20(black regions in FIG. 6), γ(m, n)=0.0.

The edited pixel value P′(i+m, j+n) is found from the following equation7, where (i, j) are the coordinates of the target pixel and P(i+m, j+n)is the corresponding pixel value in the original image data.

P′(i+m, j+n)={255−(γ(m, n)×E)}/255×P(i+m, j+n)+(γ(m, n)×E)   Equation7

The resulting edited pixel value indicates the gradation value of thecorresponding RGB color. That is, gradation values Pr′, Pg′, and Pb′ arefound for the respective RGB colors in the edited image by inputting thecorresponding gradation values Pr, Pg, and Pb for RGB colors in theoriginal image into Equation 7. Further, E is a coefficient that ismultiplied by the function y, which indicates the accentuation level ofluminance, in order to set the accentuation level. The coefficient E isfound from the following Equation 8.

E=Pg(i, j)×Li   Equation 8

Here, Pg(i, j) is the gradation value for green in the target pixel, andLi is a predetermined coefficient having a value in the range0.0≦Li≦1.0. Accordingly, the coefficient E is largest when Li is 1.0.Pg(i, j) is used to approximate a value specifying the luminance of thetarget pixel. However, the luminance value Py(i, j) may be used in placeof Pg(i, j) in the above equation to find the coefficient E.

Using Equations 7 and 8, edited pixel values are found for each pixel inthe target region centered on the target pixel by first multiplying thepixel value in the original image by a coefficient and then adding anaccentuation amount for luminance. Hence, pixel values in the originalimage data and the luminance of the target pixel are reflected in thevalue of each pixel representing the star pattern image.

The amount of luminance accentuation (γ×E) is largest near the centerpoint C of the star pattern, i.e., near the target pixel. Further,through Equation 8, the accentuation amount of luminance increases asthe luminance of the target pixel increases. In other words, the averageluminance for the pixels rendering the star pattern image is larger, thelarger the luminance of the target pixel. Further, since γ is 0 in areasoutside the star pattern (black regions in FIG. 6), P′ is equal to P(that is, the value in the original image is not changed) in theseareas.

Returning to the flowchart in FIG. 5, in S305 the CPU 11 generatesedited image data in the RAM 13 by replacing values of pixels in thetarget region of the original image data with the pixel valuescalculated in S304. Subsequent editing of image data is performed bytreating the image data generated in S305 as the original image data.Accordingly, when two star pattern images overlap, for example, theimage data edited to render the first star pattern image is furtheredited to render the second star pattern image, thereby renderingdecorative elements with a more natural expression.

In S306 the CPU 11 determines whether all target pixels have beenselected in S301. When there remain target pixels that have not yet beenselected (S306: NO), the CPU 11 returns to S301, selects a target pixelthat has not yet been processed, and repeats the above process. In thisway, a process for rendering a star pattern image is performed for alltarget pixels.

When the CPU 11 determines in S306 that all target pixels have beenselected in S301 (S306: YES), the CPU 11 ends the editing process,completing the embellishing process.

In this way, the CPU 11 generates image data in the RAM 13 by editingthe original image data. The CPU 11 generates the edited image datarepresenting an edited image having the supplemental star patternsuperimposed on the original image. The star pattern is superimposed onan area encompassing the target pixel. This edited image data may besaved on the HDD 14 and/or an edited image based on this image data maybe displayed on the display unit 16. Further, the CPU 11 may convert theedited image data to print data using a printer driver, transmit theprint data to a printer via the network interface 17, and print theedited image on paper or the like.

Next, examples will be described for editing images using theembellishing process described above. FIG. 7 shows an original image30A. FIG. 8 shows an edited image 30B produced by editing the originalimage in FIG. 7.

The original image 30A shown in FIG. 7 is a photograph taken during thedaytime with the sky in the background and a tree in the foreground. Thearea of the image representing the tree is dark overall, with mostpixels having low luminance, while the portion rendering the sky isbright overall, with concentrations of pixels having high luminance(i.e., very little variation in luminance), particularly in regionsrendering the clouds (region B, for example). When star pattern imagesare rendered according to the conventional method of simply extractingpixels with high luminance from the original image 30A, star patternimages would be rendered in bright cloud regions, such as region B, anexpression that is not very effective.

However, in the selecting process of the first embodiment, focal pixelswhose luminance varies greatly from its neighboring pixels are selectedas target pixels. Hence, the CPU 11 selects as target pixels pixels inregions containing a mixture of high-luminance and low-luminance pixels,such as region A, which includes border areas between the tree and thesky, and renders star pattern images 31 around the selected targetpixels. Hence, the CPU 11 can produce a more effective expression, as inthe leaves of the tree reflecting light.

FIGS. 9 and 10 show images 33 and 37, respectively, which are producedby editing separate original images. The image 33 of FIG. 9 depicts abright, sunny background with a lamp 34 in the foreground, and a starpattern image 35 has been produced in the original image. The image 37of FIG. 10 depicts the same lamp 34 in the foreground with a dark,nighttime background, and renders a star pattern image 38 in theoriginal image. The images 33 and 37 are equal in size.

When the CPU 11 selects a pixel near the border between the lamp 34 andthe background as a target pixel for the image 33 of FIG. 9, the firstcharacteristic value f′ indicating the variation of luminance betweenthe target pixel and its neighboring pixels is relatively small.Therefore, the length LEN of the rays of light calculated from Equation6 is relatively small.

On the other hand, in the image 37 of FIG. 10, the first characteristicvalue f′ indicating the variation of luminance between the target pixeland its neighboring pixels is relatively large for the target pixelselected near the border between the lamp 34 and the background. Hence,the length LEN of the rays of light calculated from Equation 6 is largerthan that in FIG. 9. In this way, the star pattern image is larger forthe light of light sources and the like depicted with a dark backgroundthan when depicted with a bright background, producing more naturaldecorative elements that do not seem out of place.

In the first embodiment described above, the CPU 11 selects targetpixels as pixels whose second characteristic value f related to thevariation between luminance of the pixel and the neighboring pixelssatisfies a prescribed condition (S203: YES), edits the original imagedata to render star pattern images around these target pixels, andgenerates edited data representing the edited image. In this way, thecomputer 10 of the first embodiment can enhance the expressiveness inthe edited image more than when target pixels are set simply to pixelshaving high luminance.

By selecting focal pixels as target pixels based on the single conditionthat the variation of luminance between the focal pixel and itsneighboring pixels is greater than a reference value (S203: YES), theCPU 11 is more likely to select target pixels from regions having aconcentration of pixels with a large difference in luminance, such asthe border area between a bright image and a dark image, than from aregion having a concentration of pixels with similar luminance values.

Further, by randomly extracting only some of the candidate pixels thatmeet the above condition based on a prescribed probability (0.1%, forexample) as target pixels (S207), the computer 10 can produce a morenatural effect in which the positions of the star patterns are suitablyscattered.

The computer 10 also calculates RGB gradation values (pixel values) forpixels rendering star patterns based on values of the pixels in theoriginal image (RGB gradation values) and the values of the targetpixels (the green gradation values or luminance values) based onEquation 7. In this way, the computer 10 can blend the color andluminance of the star patterns with the original image.

Further, since the average luminance of pixels in the decorative elementbeing rendered increases as the luminance of the target pixel increases(Equation 8), the computer 10 can adjust the brightness of thedecorative element based on the brightness of the target pixel.

Further, by setting the size of the star pattern image (i.e., the numberof pixels) based on the number of pixels in the original image (Equation6), the computer 10 can render the star pattern image at a suitable sizefor the original image.

The computer 10 also determines the size of the star pattern image beingrendered based on the first characteristic value f′, which is related tothe variation in luminance between the target pixel and its neighboringpixels (Equation 6). In this way, the computer 10 can enhance expressionin the image.

Specifically, by increasing the size of the star pattern image forlarger variations in luminance between the target pixel and itsneighboring pixels, the computer 10 can further accentuate light fromlight sources and the like depicted with a dark background, for example.

Next, a second embodiment of the present invention will be described.Since the structure of the computer 10 according to the secondembodiment and the majority of the processes executed by this computer10 are identical to those described in the first embodiment, like partsand components are designated with the same reference numerals and likeprocess steps will be designated with the same step numbers to avoidduplicating description.

In the first embodiment, the first characteristic value indicates thevariation of luminance between the focal pixel and its neighboringpixels, while the second characteristic value indicates the variation ofluminance between a target pixel and its neighboring pixels. However,the first and second characteristic values in the second embodimentindicate the difference between the respective focal pixel and targetpixel and its neighboring pixels.

In the selecting process of FIG. 3 according to the second embodiment,after selecting a focal pixel (S201), in S202 the CPU 11 finds thedifference between the luminance of the focal pixel and its neighboringpixels as the second characteristic value. Specifically, a secondcharacteristic value f′(i, j) is found using the following Equation 9for taking the difference between the luminance of the focal pixel Py(i,j) and the average luminance of its neighboring pixels AvePy(i, j).

f′(i, j)=Py(i, j)−AvePy(i, j)   Equation 9

The neighboring pixels of the focal pixel may be pixels that fall withinthe same range as that described in the first embodiment or pixels thatfall within a different range. Further, the second characteristic valuef′(i, j) in Equation 9 may be calculated using the green gradation valuePg(i, j) in place of the luminance value Py(i, j) and the average greengradation value of neighboring pixels AvePg(i, j) in place of theaverage luminance of the neighboring pixels AvePy(i, j).

In S203 the CPU 11 determines whether the second characteristic valuef′(i, j) calculated in S202 is greater than a predetermined referencevalue Th2. When the second characteristic value is greater than thereference value Th2 (S203: YES), in S204 the CPU 11 sets this focalpixel as a candidate pixel. If the second characteristic value is nogreater than the reference value Th2 (S203: NO), in S205 the CPU 11 setsthe target pixel as a non-candidate pixel. Subsequently, in S207 the CPU11 selects target pixels from these candidate pixels. In thedetermination of S203 in FIG. 3 according to the second embodiment, thereference value Th2 is used in place of the reference value Th.

Next, in the editing process shown in FIG. 5, the CPU 11 selects atarget pixel (S301) and finds a first characteristic value for thistarget pixel (S302). This first characteristic value indicates thedifference between the luminance of the target pixel and its neighboringpixels and may be a value calculated by normalizing f′(i, j) suitably ormay be calculated without using f′(i, j). The size of the star patternimage may be determined by replacing f′(i, j) in Equation 6 with thisfirst characteristic value and by setting the coefficient to a suitablevalue.

In the second embodiment described above, the CPU 11 selects targetpixels as pixels whose second characteristic value f′(i, j) related tothe difference in luminance between the focal pixel and the neighboringpixels satisfies a prescribed condition, and edits the original imagedata to render star pattern images around these target pixels. In thisway, the computer 10 of the second embodiment can enhance theexpressiveness in the edited image more than when target pixels are setsimply to pixels having high luminance.

By selecting focal pixels as target pixels based on the single conditionthat the difference in luminance between the focal pixel and itsneighboring pixels is greater than a reference value, the CPU 11 is morelikely to select target pixels from regions having a concentration ofpixels with a large difference in luminance, such as the border areabetween a bright image and a dark image, than from a region having aconcentration of pixels with similar luminance values.

Similar effects as those described in the first embodiment can beobtained in the second embodiment by using the first characteristicvalue related to the difference in luminance between the target pixeland its neighboring pixels and the second characteristic value relatedto the difference between the luminance of the focal pixel and itsneighboring pixels in place of the first and second characteristicvalues of the first embodiment.

While the invention has been described in detail with reference tospecific embodiments thereof, it would be apparent to those skilled inthe art that many modifications and variations may be made thereinwithout departing from the spirit of the invention, the scope of whichis defined by the attached claims.

(1) While the present invention is applied to a computer in the firstand second embodiments, the present invention may also be applied to aprinting device. FIG. 11 shows an example of a printing device 50. Theprinting device 50 includes a CPU 51, a ROM 52, a RAM 53, a NVRAM 54, areading unit 55, a printing unit 56, an operating unit 57, a displayunit 58, and a network interface 59.

In response to instructions that the user inputs on the operating unit57, the CPU 51 executes the embellishing process on original image dataacquired when the reading unit 55 reads an image from an original or onoriginal image data received from an external computer or the like (notshown) via the network interface 59, for example, and generates starpattern images. The CPU 51 controls the printing unit 56 to print theedited image data on paper or another recording medium.

(2) For the star pattern images rendered in the original image, thenumber, size, color, and position in relation to the target pixel (theangle of rotation relative to the center point, for example) ofradiating lines in the star pattern images can be modified as desired.The image processor can also generate decorative elements of variousshapes, such as a hexagonal or heart shape, and is not limited to starpattern images. The image processor is particularly effective whengenerating images that enhance light from light sources in the originalimage or portions of the image with high luminance as decorativeelements, but is not limited to these aspects.

(3) The shape, size, color, number, and the like of decorative elementsmay be determined based on user preferences.

(4) In the first and second embodiments, the image processor determinesthe size of the star pattern images based on the first characteristicvalue. However, the image processor may determine the form of thedecorative elements, including its shape, color, and luminance, asfollows.

First, the image processor may modify the number of radiating linesbased on the first characteristic value. For example, the imageprocessor may set a larger number of radiating lines for a largerdifference in the variation of luminance between the target pixel andits neighboring pixels, as in six radiating lines for a firstcharacteristic value f′ in the range 0.6-0.8 and eight radiating linesfor a first characteristic value f′ in the range 0.8-1.0.

The image processor may also modify the color of the decorative elementsbased on the first characteristic value. For example, the imageprocessor may set the color of the element to red when the firstcharacteristic value f′ is in the range 0.6-0.8 and orange when thefirst characteristic value f′ is in the range 0.8-1.0.

The image processor may also modify the luminance of the decorativeelements based on the first characteristic value. For example, thecoefficient Li may be set to 0.8 in Equation 8 when the firstcharacteristic value f′ is in the range 0.6-0.8 and to 0.9 when thefirst characteristic value f′ is in the range 0.8-1.0. A particularlyeffective expression can be reduced by increasing the luminance of thedecorative element as the difference in variation of luminance increasesbetween the target pixel and its neighboring pixels.

(5) In the first and second embodiments, the image processor determinesthe size of the star pattern images based on the length (number ofpixels) of the longer side constituting the original image data.However, the image processor may determine the size of the decorativeelement based on the total number of pixels (area) in the original imagedata.

(6) In the first and second embodiments (Equation 7), the imageprocessor calculates the pixel value (RGB gradation values) of pixelsrepresenting the star pattern image based on the pixel values (RGBgradation values) in the original image and the luminance (greengradation value) of the focal pixel. However, the image processor maycalculate the pixel values of pixels rendering the star pattern imagebased on only one of these elements. For example, the image processorcan produce a decorative element in a color unrelated to the color ofthe pixels in the original image. Further, while the pixel values areRGB gradation values in the first and second embodiments, values forluminance and color differences of pixels may be used as the pixelvalues, for example.

(7) In the first and second embodiments, the neighboring pixels of thefocal pixel (or target pixel) are the 24 nearest pixels surrounding thefocal pixel (or target pixel). However, the range and number ofneighboring pixels may be modified as desired and need not be the samefor the focal pixel and target pixel. For example, a single pixeladjacent to the focal pixel (or target pixel) may serve as theneighboring pixel. Further, the CPU 11 may set, as the near pixels(neighboring pixels), pixels near the focal pixel (or target pixel)excluding pixels adjacent to the focal pixel (or target pixel).

(8) In the first and second embodiments, the first and secondcharacteristic values are values indicating the variation in luminanceor values indicating the difference in luminance, but the characteristicvalues may be related to both the variation in luminance and thedifference in luminance. For example, the first characteristic value orsecond characteristic value may be a value obtained by multiplying thevariance indicating variation in luminance and a value indicating thedifference in luminance by respective suitable coefficients and byadding the two results.

(9) In the first and second embodiments, the target pixel is positionedin the center of the decorative element, but the position of the targetpixel is not limited to the center point. For example, the target pixelmay be positioned near one end of the decorative element, or thedecorative element may be arranged in a location apart from the targetpixel.

(10) In the first and second embodiments, the image processor selects aplurality of candidate pixels from the original image data and selectstarget pixels from the plurality of candidate pixels, but the imageprocessor may set all pixels having a second characteristic value thatexceeds a reference value to target pixels. Further, in the process ofS207 for selecting target pixels from the plurality of candidate pixels,the image processor may select target pixels for producing apredetermined number of decorative elements.

(11) In the first and second embodiments, the image data has 8-bit(256-level) data for each of the RGB colors, but the image processor ofthe present invention may be configured to edit data having differentgradation values, such as 2-bit, 4-bit, or 16-bit image data. Further,the image data edited by the image processor may be a different dataformat than RGB data, such as YUV data.

Further, in Equation 7 the image processor finds RGB gradation values(pixel values) in the edited image based on RGB gradation values (pixelvalues) in the original image data and the luminance (pixel value) ofthe target pixel, but these pixel values may be replaced with othertypes of pixel values as desired, such as a luminance Y and colordifferences U and V. In other words, the image processor can adapt thecolor and luminance of the star pattern image to the original image bycalculating values of pixels rendering the star pattern image based onthe values of pixels in the same location of the original image and thevalue of the target pixel.

(12) In the editing process (FIG. 5) of the first and secondembodiments, the image processor generates edited image data thatincludes star pattern images by calculating edited pixel values based onthe first characteristic value f′ and the length (number of pixels) ofthe longer side constituting the original image data for each targetpixel, but the present invention is not limited to this process. Forexample, the image processor may generate edited image data by settingthe decorative element to an image stored on the 1 to an image stored onthe 14 or the like and by adding (synthesizing) this decorative elementto each target pixel.

(13) In the first and second embodiments, the focal pixel setting unit,the near pixel setting unit, the calculating unit, the target pixeldetermining unit, and the editing unit of the present invention are allimplemented by the same CPU. However, these units of the presentinvention may be implemented with different CPUs, ASICs, or othercircuits.

What is claimed is:
 1. An image processing device comprising: aprocessor; and a memory storing computer-readable instructions therein,the computer-readable instructions, when executed by the processor,causing the image processing device to perform: setting a focal pixelamong a plurality of pixels in an original image that is represented byoriginal image data; setting a pixel near the focal pixel as a nearpixel; acquiring a degree of difference in luminance for the focal pixeland the near pixel; determining, based on the degree of difference, atleast one of: a size of a supplemental image; a shape of thesupplemental image; color of the supplemental image; and luminance ofthe supplemental image; and generating edited image data by editing theoriginal image data, the edited image data representing an edited imageobtained by superimposing the supplemental image on the original image,the supplemental image being superimposed on an area around the focalpixel in the original image.
 2. The image processing device according toclaim 1, wherein a variation in the luminance between the focal pixeland the near pixel is acquired as the degree of difference.
 3. The imageprocessing device according to claim 1, wherein a difference between theluminance of the focal pixel and the luminance of the near pixel isacquired as the degree of difference.
 4. The image processing deviceaccording to claim 1, wherein a plurality of pixels is contained in thearea of the original image, each of the plurality of pixels contained inthe area having a pixel value, the focal pixel having a pixel value;wherein the supplemental image has a plurality of supplemental pixelseach corresponding to one of the plurality of pixels contained in thearea; wherein the computer-readable instructions, when executed by theprocessor, causes the image processing device to further performcalculating a pixel value of each supplemental pixel based on the pixelvalue of the focal pixel and the pixel value of the corresponding one ofplurality of pixels contained in the area of the original image; andwherein the edited image data is generated based on the pixel value ofeach of the plurality of supplemental pixels.
 5. The image processingdevice according to claim 1, wherein the focal pixel has luminance;wherein the supplemental image includes a supplemental pixel havingluminance; wherein the larger the luminance of the focal pixel is, thelarger the luminance of the supplemental pixel is.
 6. The imageprocessing device according to claim 1, wherein the supplemental imagehas supplemental pixels; wherein the computer-readable instructions,when executed by the processor, causes the image processing device tofurther perform determining a number of supplemental pixels in thesupplemental image based on a number of pixels contained in the originalimage.
 7. The image processing device according to claim 1, wherein thecomputer-readable instructions, when executed by the processor, causesthe image processing device to further perform: setting another focalpixel among the plurality of pixels in the original image; setting apixel near the another focal pixel as a corresponding near pixel;acquiring a degree of difference in luminance for the another focalpixel and the corresponding near pixel; determining, based on the degreeof difference, at least one of: a size of another supplemental image; aformation of the another supplemental image; color of the anothersupplemental image; and luminance of the another supplemental image; andgenerating another edited image data by editing the edited image data,the another edited image data representing another edited image obtainedby superimposing the another supplemental image on the edited image, theanother supplemental image being superimposed on another area in theedited image, the another area corresponding to an area around theanother focal pixel in the original image.
 8. The image processingdevice according to claim 1, wherein each of the plurality of pixels inthe original image is set as a focal pixel; wherein a pixel near eachfocal pixel is set as a corresponding near pixel; wherein a degree ofdifference in luminance for each focal pixel and the corresponding nearpixel is acquired; wherein the computer-readable instructions, whenexecuted by the processor, causes the image processing device to furtherperform determining, as a target pixel, the focal pixel whose degree ofdifference satisfies a prescribed condition; wherein the at least oneof: a size of the supplemental image; a shape of the supplemental image;color of the supplemental image; and luminance of the supplementalimage; is determined based on the degree of difference of the targetpixel, and wherein the edited image data is generated by editing theoriginal image data, the edited image data representing the edited imagehaving the supplemental image superimposed on the original image, thesupplemental image being superimposed on an area around the target pixelin the original image.
 9. The image processing device according to claim8, wherein, if a degree of difference of each of at least two focalpixels satisfies the prescribed condition, a part of the at least twofocal pixels is determined as the target pixel.
 10. The image processingdevice according to claim 1, further comprising a printing unitconfigured to print the edited image on a recording medium based on theedited image data.
 11. A non-transitory computer readable storage mediumstoring a set of program instructions, the program instructions, whenexecuted by a processor, causing an image processing device to perform:setting a focal pixel among a plurality of pixels in an original imagethat is represented by original image data; setting a pixel near thefocal pixel as a near pixel; acquiring a degree of difference inluminance for the focal pixel and the near pixel; determining, based onthe degree of difference, at least one of: a size of a supplementalimage; a shape of the supplemental image; color of the supplementalimage; and luminance of the supplemental image; and generating editedimage data by editing the original image data, the edited image datarepresenting an edited image obtained by superimposing the supplementalimage on the original image, the supplemental image being superimposedon an area around the focal pixel in the original image.